package core;

import core.router.Router;
import core.schedulers.PacketScheduler;
import core.schedulers.SchedulerKind;

public class Starter {

	private static Starter instance;

	private Starter() {
	}

	public static Starter getInstance() {
		if (instance == null)
			instance = new Starter();
		return instance;
	}

	public void start(double meanPacketSizeLan, double meanPacketSizeNet,
			double bandwidth, double lanMeanPacketInterval,
			double netMeanPacketInterval, long routerQueueCapacity) {
		
		Router newRouter = new Router(routerQueueCapacity, bandwidth);
		
		PacketScheduler lanScheduler = new PacketScheduler(meanPacketSizeLan,
				lanMeanPacketInterval, SchedulerKind.LAN);
		lanScheduler.addListener(newRouter.getLanWoker());
		
		PacketScheduler netScheduler = new PacketScheduler(meanPacketSizeNet,
				netMeanPacketInterval,
				SchedulerKind.INTERNET);
		netScheduler.addListener(newRouter.getNetWorker());
	}
}
